<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class SeedCategoryData extends Migration
{
    /**
     * Run the migrations.
     *创建默认分类数据
     * @return void
     */
    public function up()
    {
        $category=[
            [
                'name'=>'家用电器',
                'introduction'=>'这里是产品的详情',
                'parent_id'=>0,
                'level'=>1
            ],
            [
                'name'=>'手机',
                'introduction'=>'这里是产品的详情',
                'parent_id'=>1,
                'level'=>2
            ],
            [
                'name'=>'电视机',
                'introduction'=>'这里是产品的详情',
                'parent_id'=>1,
                'level'=>2
            ],
            [
                'name'=>'洗衣机',
                'introduction'=>'这里是产品的详情',
                'parent_id'=>1,
                'level'=>2
            ]
        ];
        DB::table('product_categories')->insert($category);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        DB::table('categories')->truncate();
    }
}
